<template>
  <div class="commonpanel">
    <div class="titleline">
      <div class="title">{{ title }}</div>
      <div class="titlebg" :class="titleBgClass"></div>
      <div class="rightcontent">
        <slot name="rightcontent"></slot>
      </div>
    </div>
    <div class="contentline">
      <slot></slot>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';

const props = defineProps({
  title: {
    type: String,
    default: '',
  },
  titleBg: {
    type: String,
    default: '',
  },
})

const titleBgClass = computed(() => {
  const titleBg = props.titleBg;
  if (titleBg && titleBg === 'green') {
    return 'green-title-bg';
  } else {
    return '';
  }
});
</script>
<style lang="scss" scoped>
.commonpanel {
  height: 100%;
  overflow: hidden;
  background-color: rgba(37, 197, 241, 0.5);
  background-size: 100% 100%;
  background-repeat: no-repeat;

  display: flex;
  flex-direction: column;

  .titleline {
    height: 38px;
    position: relative;
    margin-left: 20px;
    margin-right: 20px;

    .title {
      position: absolute;
      bottom: 0;
      left: 12px;

      font-size: 18px;
      font-family:
        PingFangSC-Semibold,
        PingFang SC;
      font-weight: 600;
      color: #ffffff;
      line-height: 18px;
      text-shadow: 0px 0px 23px rgba(35, 136, 250, 0.26);
      z-index: 20;
    }

    .titlebg {
      height: 10px;
      width: 100%;
      position: absolute;
      bottom: 0;
      background: url('@/assets/img/title-bg.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
    }

    .green-title-bg {
      background: url('@/assets/img/title-bg-green.png');
    }

    .rightcontent {
      height: 100%;
      overflow: hidden;
      float: right;
    }
  }

  .contentline {
    flex: 1;
  }
}
</style>
